
var fjy_language = {
    create: function (args) {      
        if (window.localStorage.language == undefined) {          
           window.localStorage.language = "en";
        }
       
        var lg = {};
        lg.language = args.language;        
        lg.languageCode = window.localStorage.language;

        lg.getLanguage = function () {
            return window.localStorage.language;
        };

        lg.setLanguage = function (lgCode) {           
            window.localStorage.language = lgCode;           
        };

        lg.getValue = function (code) {
            for (i = 0; i < lg.language.length; i++) {
                var o = lg.language[i];
                if (o.code == code) return o[this.languageCode];
            }
        };

        lg.translating = function (id) {      
            var tempHtml=document.getElementById(id).innerHTML;
            for (i = 0; i < lg.language.length; i++) {
                var o = lg.language[i];
                var re = eval("/" + o.code + "/g");
                tempHtml = tempHtml.replace(re, o[this.languageCode]);
            }
            document.getElementById(id).innerHTML=tempHtml;
        };


        return lg;
    }
};